//
//  DailyView.m
//  Streaming
//
//  Created by 官琛 on 15-6-23.
//  Copyright (c) 2015年 liuxun. All rights reserved.
//

#import "DailyView.h"

@implementation DailyView


-(instancetype)initWithFrame:(CGRect)frame movie:(NSInteger)movieID
{
    self = [super initWithFrame:frame];
    if (self) {
        self.movieId = movieID;
        
        [self creatScrollView];
    }

    return self;
}

-(void)creatScrollView
{
    [self afnGetRequest1];
    
    self.scrollView = [[UIScrollView alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    self.scrollView.contentSize = CGSizeMake(0, 375*3);
    self.scrollView.delegate = self;
    [self addSubview:self.scrollView];
 //电影详情
    self.viewDaily = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 260)];
    self.viewDaily.backgroundColor = [UIColor whiteColor];
    self.viewDaily.userInteractionEnabled = YES;
    [self.scrollView addSubview:self.viewDaily];
    
    
    UIButton *Favorites = [UIButton buttonWithType:UIButtonTypeCustom];
    Favorites.frame = CGRectMake(330, 40, 30, 30);
    [Favorites setBackgroundImage:[UIImage imageNamed:@"iconfont-shoucang.png"] forState:UIControlStateNormal];
    [Favorites addTarget:self action:@selector(FavoritesAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.viewDaily addSubview:Favorites];
    
    self.img = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 100, 140)];
    self.img.backgroundColor = [UIColor cyanColor];
    [self.viewDaily addSubview:self.img];
    self.img.userInteractionEnabled = YES;
    [_img release];
    
    UIButton *mp4Button = [UIButton buttonWithType:UIButtonTypeCustom];
    mp4Button.frame = CGRectMake(30, 40, 40, 40);
    [mp4Button setBackgroundImage:[UIImage imageNamed:@"iconfont-bofang-2.png"] forState:UIControlStateNormal];
    [mp4Button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.img addSubview:mp4Button];
    
    self.t = [[UILabel alloc]initWithFrame:CGRectMake(self.img.frame.size.width+20, self.img.frame.origin.y, 200, 30)];
    self.t.font = [UIFont boldSystemFontOfSize:20];
    [self.viewDaily addSubview:self.t];
    [_t release];
    
    self.tEn = [[UILabel alloc]initWithFrame:CGRectMake(self.t.frame.origin.x, self.t.frame.origin.y+self.t.frame.size.height + 10, 200, 20)];
    self.tEn.textColor = [UIColor lightGrayColor];
    self.tEn.font = [UIFont systemFontOfSize:12];
    [self.viewDaily addSubview:self.tEn];
    [_tEn release];
    
    self.rating = [[UILabel alloc]initWithFrame:CGRectMake(300, self.tEn.frame.origin.y+20, 90, 30)];
    [self.viewDaily addSubview:self.rating];
    [_rating release];
    
    self.d = [[UILabel alloc]initWithFrame:CGRectMake(self.tEn.frame.origin.x, self.tEn.frame.origin.y+self.tEn.frame.size.height+20, 50, 20)];
    self.d.font = [UIFont systemFontOfSize:12];
    [self.viewDaily addSubview:self.d];
    [_d release];
    
    self.type = [[UILabel alloc]initWithFrame:CGRectMake(self.d.frame.origin.x, self.d.frame.origin.y+17, 80, 20)];
    self.type.font = [UIFont systemFontOfSize:12];
    [self.viewDaily addSubview:self.type];
    [_type release];
    
    self.showTime = [[UILabel alloc]initWithFrame:CGRectMake(self.type.frame.origin.x, self.type.frame.origin.y+self.type.frame.size.height, 200, 20)];
    self.showTime.font = [UIFont systemFontOfSize:12];
//    self.showTime.backgroundColor = [UIColor blackColor];
    [self.viewDaily addSubview:self.showTime];
    [_showTime release];
    
    self.pt = [[UILabel alloc]initWithFrame:CGRectMake(self.img.frame.origin.x, self.img.frame.origin.y+self.img.frame.size.height, 355, 60)];
    self.pt.numberOfLines = 0;
    self.pt.userInteractionEnabled = YES;
    self.pt.font = [UIFont systemFontOfSize:15];
//    self.pt.backgroundColor = [UIColor blueColor];
    [self.viewDaily addSubview:self.pt];
    [_pt release];
    
    
    self.detailsButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.detailsButton.frame = CGRectMake(0, 0, 355, 110);
//    self.detailsButton.backgroundColor = [UIColor blackColor];
    [self.detailsButton addTarget:self action:@selector(buttonAction1:) forControlEvents:UIControlEventTouchUpInside];
    [self.pt addSubview:self.detailsButton];
    self.buttonState = NO;
    //展开按钮图片
    self.unfold = [[UIImageView alloc]initWithFrame:CGRectMake(180, self.pt.frame.origin.y+self.pt.frame.size.height-10, 30, 30)];
    self.unfold.image = [UIImage imageNamed:@"iconfont-zhankai.png"];
    [self.viewDaily addSubview:self.unfold];
    [_unfold release];
    
    
//导演 演员
    self.viewPerson = [[UIView alloc]initWithFrame:CGRectMake(0, self.viewDaily.frame.origin.y+self.viewDaily.frame.size.height+30, WIDTH, 300)];
    [self.scrollView addSubview:self.viewPerson];
    self.viewPerson.backgroundColor = [UIColor whiteColor];
    
    UILabel *dirLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 50, 30)];
    dirLabel.text = @"导 演 ";
    [self.viewPerson addSubview:dirLabel];
    [dirLabel release];
    
    self.directorImg = [[UIImageView alloc]initWithFrame:CGRectMake(10, dirLabel.frame.origin.y+dirLabel.frame.size.height+10, 100, 130)];
    self.directorImg.backgroundColor = [UIColor redColor];
    [self.viewPerson addSubview:self.directorImg];
    self.directorImg.userInteractionEnabled = YES;
    [_directorImg release];
    
    UIButton *dirButton = [UIButton buttonWithType:UIButtonTypeCustom];
    dirButton.frame = CGRectMake(0, 0, 90, 110);
    dirButton.tag = 10000;
    [dirButton addTarget:self action:@selector(personButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.directorImg addSubview:dirButton];
    
    self.dN = [[UILabel alloc]initWithFrame:CGRectMake(10, self.directorImg.frame.origin.y+self.directorImg.frame.size.height+10, self.directorImg.frame.size.width, 30)];
     self.dN.font = [UIFont systemFontOfSize:12];
    self.dN.textAlignment = NSTextAlignmentCenter;
    [self.viewPerson addSubview:self.dN];
    [_dN release];
    
    self.directorNameEn = [[UILabel alloc]initWithFrame:CGRectMake(self.dN.frame.origin.x, self.dN.frame.origin.y+20, 100, 30)];
    self.directorNameEn.font = [UIFont systemFontOfSize:12];
    self.directorNameEn.textAlignment = NSTextAlignmentCenter;
    [self.viewPerson addSubview:self.directorNameEn];
    [_directorNameEn release];
 
    UILabel *actLabel = [[UILabel alloc]initWithFrame:CGRectMake(dirLabel.frame.origin.x+dirLabel.frame.size.width+80, 10, 80, 30)];
    actLabel.text = @"主要演员";
    [self.viewPerson addSubview:actLabel];
    [actLabel release];
    
    self.actorImg1 = [[UIImageView alloc]initWithFrame:CGRectMake(actLabel.frame.origin.x, self.directorImg.frame.origin.y, 90, 110)];
    self.actorImg1.backgroundColor = [UIColor cyanColor];
    [self.viewPerson addSubview:self.actorImg1];
    self.actorImg1.userInteractionEnabled = YES;
    [_actorImg1 release];
    
    UIButton *dnButton = [UIButton buttonWithType:UIButtonTypeCustom];
    dnButton.frame = CGRectMake(0, 0, 90, 110);
    dnButton.tag = 10001;
    [dnButton addTarget:self action:@selector(personButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.actorImg1 addSubview:dnButton];
    
    self.aN1 = [[UILabel alloc]initWithFrame:CGRectMake(self.actorImg1.frame.origin.x, self.actorImg1.frame.origin.y+self.actorImg1.frame.size.height, 100, 30)];
    self.aN1.font = [UIFont systemFontOfSize:12];
    self.aN1.textAlignment = NSTextAlignmentCenter;
    [self.viewPerson addSubview:self.aN1];
    [_aN1 release];
    
    self.actNameEn1 = [[UILabel alloc]initWithFrame:CGRectMake(self.actorImg1.frame.origin.x, self.actorImg1.frame.origin.y+self.actorImg1.frame.size.height+25, self.actorImg1.frame.size.width, 20)];
    self.actNameEn1.textAlignment = NSTextAlignmentCenter;
    self.actNameEn1.font = [UIFont systemFontOfSize:12];
    [self.viewPerson addSubview:self.actNameEn1];
    [_actNameEn1 release];
    
    self.roleImg1 = [[UIImageView alloc]initWithFrame:CGRectMake(self.actNameEn1.frame.origin.x + 30, self.actNameEn1.frame.origin.y+40, 40, 40)];
    self.roleImg1.layer.masksToBounds = YES;
    self.roleImg1.layer.cornerRadius = 20;
    self.roleImg1.backgroundColor = [UIColor cyanColor];
    [self.viewPerson addSubview:self.roleImg1];
    [_roleImg1 release];
    
    self.roleName1 = [[UILabel alloc]initWithFrame:CGRectMake(self.roleImg1.frame.origin.x-40, self.roleImg1.frame.origin.y+40, 100, 20)];
    self.roleName1.textAlignment = NSTextAlignmentCenter;
    self.roleName1.font = [UIFont systemFontOfSize:12];
    [self.viewPerson addSubview:self.roleName1];
    [_roleName1 release];
    
    self.actorImg2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.actorImg1.frame.origin.x+self.actorImg1.frame.size.width+20, self.actorImg1.frame.origin.y, 90, 110)];
    self.actorImg2.backgroundColor = [UIColor cyanColor];
    [self.viewPerson addSubview:self.actorImg2];
    self.actorImg2.userInteractionEnabled = YES;
    [_actorImg2 release];
    
    UIButton *anButton = [UIButton buttonWithType:UIButtonTypeCustom];
    anButton.frame = CGRectMake(0, 0, 90, 110);
    anButton.tag = 10002;
    [anButton addTarget:self action:@selector(personButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.actorImg2 addSubview:anButton];
    
    self.aN2 = [[UILabel alloc]initWithFrame:CGRectMake(self.actorImg2.frame.origin.x, self.actorImg2.frame.origin.y+self.actorImg2.frame.size.height, 100, 30)];
     self.aN2.font = [UIFont systemFontOfSize:12];
    self.aN2.textAlignment = NSTextAlignmentCenter;
    [self.viewPerson addSubview:self.aN2];
    [_aN2 release];
    
    self.actNameEn2 = [[UILabel alloc]initWithFrame:CGRectMake(self.actorImg2.frame.origin.x, self.actorImg2.frame.origin.y+self.actorImg2.frame.size.height+25, 100, 20)];
    self.actNameEn2.font = [UIFont systemFontOfSize:12];
    self.actNameEn2.textAlignment = NSTextAlignmentCenter;
    [self.viewPerson addSubview:self.actNameEn2];
    [_actNameEn2 release];
    
    self.roleImg2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.actNameEn2.frame.origin.x + 30, self.actNameEn2.frame.origin.y+40, 40, 40)];
    self.roleImg2.layer.masksToBounds = YES;
    self.roleImg2.layer.cornerRadius = 20;
    self.roleImg2.backgroundColor = [UIColor cyanColor];
    [self.viewPerson addSubview:self.roleImg2];
    [_roleImg2 release];
    
    self.roleName2 = [[UILabel alloc]initWithFrame:CGRectMake(self.roleImg2.frame.origin.x-40, self.roleImg2.frame.origin.y+40, 100, 20)];
    self.roleName2.textAlignment = NSTextAlignmentCenter;
    self.roleName2.font = [UIFont systemFontOfSize:12];
    [self.viewPerson addSubview:self.roleName2];
    [_roleName2 release];
    
    self.still = [[UIView alloc]initWithFrame:CGRectMake(0, self.viewPerson.frame.origin.y+self.viewPerson.frame.size.height+30, WIDTH, 150)];
    self.still.backgroundColor = [UIColor whiteColor];
    [self.scrollView addSubview:self.still];
    
    UILabel *stillLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 30)];
    stillLabel.text = @"剧照";
    [self.still addSubview:stillLabel];
    [stillLabel release];
    
    self.stillImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, 50, 80, 80)];
//    self.stillImage1.backgroundColor = [UIColor blackColor];
    [self.still addSubview:self.stillImage1];
    [_stillImage1 release];
    
    self.stillImage2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.stillImage1.frame.origin.x+self.stillImage1.frame.size.width+10, 50, 80, 80)];
//    self.stillImage2.backgroundColor = [UIColor blackColor];
    [self.still addSubview:self.stillImage2];
    [_stillImage2 release];
    
    self.stillImage3 = [[UIImageView alloc]initWithFrame:CGRectMake(self.stillImage2.frame.origin.x+self.stillImage2.frame.size.width+10, 50, 80, 80)];
//    self.stillImage3.backgroundColor = [UIColor blackColor];
    [self.still addSubview:self.stillImage3];
    [_stillImage3 release];
    
    self.stillImage4 = [[UIImageView alloc]initWithFrame:CGRectMake(self.stillImage3.frame.origin.x+self.stillImage3.frame.size.width+10, 50, 80, 80)];
//    self.stillImage4.backgroundColor = [UIColor blackColor];
    [self.still addSubview:self.stillImage4];
    [_stillImage4 release];
    
    UIButton *stillButton = [UIButton buttonWithType:UIButtonTypeCustom];
    stillButton.frame = CGRectMake(0, 30, WIDTH, 90);
    [stillButton addTarget:self action:@selector(stillButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.still addSubview:stillButton];
//影评
    self.review = [[UIView alloc]initWithFrame:CGRectMake(0, self.still.frame.origin.y+self.still.frame.size.height+30, WIDTH, 50)];
    self.review.backgroundColor = [UIColor whiteColor];
    [self.scrollView addSubview:self.review];
    
    UIButton *reviewButton = [UIButton buttonWithType:UIButtonTypeCustom];
    reviewButton.frame = CGRectMake(150, 10, 80, 30);
    [reviewButton setTitle:@"查看影评" forState:UIControlStateNormal];
    [reviewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [reviewButton addTarget:self action:@selector(reviewAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.review addSubview:reviewButton];
    [_review release];
    [_viewPerson release];
    [_viewDaily release];
    [_scrollView release];
    
    
    
}
//跳转Person
-(void)personButton:(UIButton *)button
{
    if (button.tag == 10000) {
        [self.perDelegate pushPerson:self.directorId];
    }
    if (button.tag == 10001) {
        [self.perDelegate pushPerson:self.actorId1];
    }
    if (button.tag == 10002) {
        [self.perDelegate pushPerson:self.actorId2];
    }
}

//评论
-(void)reviewAction:(UIButton *)button
{
 
    [self.myDelegate pushReview:self.movieId];

}
//剧照
-(void)stillButton:(UIButton *)button
{
    
    [self.myDelegate1 pushPhoto:self.movieId];
}

//收藏电影
-(void)FavoritesAction:(UIButton *)button
{
    NSLog(@"收藏");
}

//Label自适应高度
-(CGSize)getHight:(NSString *)str
{
    CGSize size = CGSizeMake(355, FLT_MAX);
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:self.pt.font,NSFontAttributeName, nil];
    CGSize actualsize = [str boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size;
    return actualsize;
    
    
    
}
//展开剧情
-(void)buttonAction1:(UIButton *)button
{

//    self.pt.numberOfLines = 0;
//    [self.pt sizeToFit];
  
    if (self.buttonState == NO) {
        float height = [self getHight:self.pt.text].height;
    self.pt.frame = CGRectMake(self.img.frame.origin.x, self.img.frame.origin.y+self.img.frame.size.height, 355, height);
    button.frame = CGRectMake(0,0, self.pt.frame.size.width, self.pt.frame.size.height);
    self.viewDaily.frame = CGRectMake(0, 0, WIDTH, 200+self.pt.frame.size.height);
    self.viewPerson.frame = CGRectMake(0, self.viewDaily.frame.origin.y+self.viewDaily.frame.size.height+30, WIDTH, 300);
    self.unfold.frame = CGRectMake(180, self.pt.frame.origin.y+self.pt.frame.size.height-10, 30, 30);
    self.unfold.image = [UIImage imageNamed:@"iconfont-shouhui.png"];
        self.still.frame = CGRectMake(0, self.viewPerson.frame.origin.y+self.viewPerson.frame.size.height+30, WIDTH, 150);
        self.buttonState = YES;
    }
    else
    {
        self.pt.frame = CGRectMake(self.img.frame.origin.x, self.img.frame.origin.y+self.img.frame.size.height, 355, 60);
        self.viewDaily.frame = CGRectMake(0, 0, WIDTH, 260);
        self.viewPerson.frame = CGRectMake(0, self.viewDaily.frame.origin.y+self.viewDaily.frame.size.height+30, WIDTH, 300);
        self.unfold.frame = CGRectMake(180, self.pt.frame.origin.y+self.pt.frame.size.height-10, 30, 30);
        self.unfold.image = [UIImage imageNamed:@"iconfont-zhankai.png"];
        self.still.frame = CGRectMake(0, self.viewPerson.frame.origin.y+self.viewPerson.frame.size.height+30, WIDTH, 150);
        self.buttonState = NO;
    
    }
    
    


}

//视频播放
-(void)buttonAction:(UIButton *)button
{
    
    NSURL *url = [NSURL URLWithString:self.video];

    self.stream = [[MPMoviePlayerController alloc]initWithContentURL:url];
    [self.stream.view setFrame:self.bounds];
    self.stream.controlStyle = MPMovieControlStyleEmbedded;
    [self addSubview:self.stream.view];
    [self.stream play];
    [_stream release];
}

-(void)afnGetRequest1
{
    NSLog(@"%ld",self.movieId);
    AFNetworkReachabilityManager *netWorkManager = [AFNetworkReachabilityManager sharedManager];
   
    NSString *url_string = [NSString stringWithFormat:@"http://api.m.mtime.cn/Showtime/MovieDetail.api?locationId=729&movieId=%ld",self.movieId];
    
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"application/x-javascript",@"text/html",nil];
    
    
    [manager.requestSerializer setValue:@"_alicdn_tc=AQAAAB371QrubggAyKc/3jksFX1Y3Pus; _alicdn_tc2=AQAAALULw2Ii5QgAyKc/3jTLsYoOoSCM" forHTTPHeaderField:@"Cookie"];
    
    [manager.requestSerializer setValue:@"5,1435285084289,30E19118BD7AE0531B1284C38D76C657" forHTTPHeaderField:@"X-Mtime-Mobile-CheckValue"];
    
  
    [manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        [netWorkManager stopMonitoring];
//        NSLog(@"使用AFN进行get请求 ===  %@",responseObject);
        //电影详情
        NSMutableArray *parr = [NSMutableArray array];
        self.t.text = [responseObject objectForKey:@"t"];
        self.tEn.text = [responseObject objectForKey:@"tEn"];
        float r1 = [[responseObject objectForKey:@"r"]floatValue];
        self.rating.text = [NSString stringWithFormat:@"评分:%.1f",r1];
        parr = [responseObject objectForKey:@"p"];
        NSString *str1 = [parr objectAtIndex:0];
        NSString *str2 = [parr objectAtIndex:1];
        self.type.text = [NSString stringWithFormat:@"%@ / %@",str1,str2];
        NSString *str3 = [responseObject objectForKey:@"rd"];
        NSString *str4 = [responseObject objectForKey:@"year"];
        NSRange range1 = NSMakeRange(4, 2);
        NSString *str5 = [str3 substringWithRange:range1];
        NSRange range2 = NSMakeRange(6, 2);
        NSString *str6 = [str3 substringWithRange:range2];
        NSString *str7 = [responseObject objectForKey:@"rLocation"];
        self.showTime.text = [NSString stringWithFormat:@"%@年%@月%@日 %@上映",str4,str5,str6,str7];
        self.d.text = [responseObject objectForKey:@"d"];
        NSString *ptStr = [responseObject objectForKey:@"pt"];
        self.pt.text = [NSString stringWithFormat:@"介绍:%@",ptStr];
        NSURL *url = [NSURL URLWithString:[responseObject objectForKey:@"img"]];
        [self.img sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        self.video = [responseObject objectForKey:@"video"];
        //导演  & 演员
        self.dN.text = [responseObject objectForKey:@"dN"];
        self.aN1.text = [responseObject objectForKey:@"aN1"];
        self.aN2.text = [responseObject objectForKey:@"aN2"];
        NSMutableDictionary *dic = [NSMutableDictionary dictionary ];
        dic = [responseObject objectForKey:@"director"];
        self.directorNameEn.text = [dic objectForKey:@"directorNameEn"];
        self.directorId = [[dic objectForKey:@"directorId"]integerValue];
        NSString *dirStr = [dic objectForKey:@"directorImg"];
        NSURL *dirUrl = [NSURL URLWithString:dirStr];
        [self.directorImg sd_setImageWithURL:dirUrl placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        NSMutableArray *actors = [NSMutableArray array];
        actors = [responseObject objectForKey:@"actors"];
        NSMutableDictionary *dic1 = [actors objectAtIndex:0];
        NSMutableDictionary *dic2 = [actors objectAtIndex:1];
        
        self.actNameEn1.text = [dic1 objectForKey:@"actorEn"];
        self.actorId1 = [[dic1 objectForKey:@"actorId"]integerValue];
        NSString *role1 = [dic1 objectForKey:@"roleName"];
        self.roleName1.text = [NSString stringWithFormat:@"饰:%@",role1];
        NSString *actStr1 = [dic1 objectForKey:@"actorImg"];
        NSURL *actUrl1 = [NSURL URLWithString:actStr1];
        [self.actorImg1 sd_setImageWithURL:actUrl1 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        NSString *roleStr1 = [dic1 objectForKey:@"roleImg"];
        NSURL *roleUrl1 = [NSURL URLWithString:roleStr1];
        [self.roleImg1 sd_setImageWithURL:roleUrl1 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        
        self.actNameEn2.text = [dic2 objectForKey:@"actorEn"];
        self.actorId2 = [[dic2 objectForKey:@"actorId"]integerValue];
        NSString *role2 = [dic2 objectForKey:@"roleName"];
        self.roleName2.text = [NSString stringWithFormat:@"饰:%@",role2];
        NSString *actStr2 = [dic2 objectForKey:@"actorImg"];
        NSURL *actUrl2 = [NSURL URLWithString:actStr2];
        [self.actorImg2 sd_setImageWithURL:actUrl2 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        NSString *roleStr2 = [dic2 objectForKey:@"roleImg"];
        NSURL *roleUrl2 = [NSURL URLWithString:roleStr2];
        [self.roleImg2 sd_setImageWithURL:roleUrl2 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        //剧照
        NSMutableArray *stillArray = [responseObject objectForKey:@"movieimg"];
        self.imageArray = [NSMutableArray array];
        for (NSMutableDictionary *dic in stillArray) {
            Photo *photo = [[Photo alloc]init];
            photo.photoId = [[dic objectForKey:@"id"]integerValue];
            photo.image = [dic objectForKey:@"image"];
            [self.imageArray addObject:photo];
            [photo release];
        }
        NSMutableDictionary *stillDic1 = [NSMutableDictionary dictionary];
        NSMutableDictionary *stillDic2 = [NSMutableDictionary dictionary];
        NSMutableDictionary *stillDic3 = [NSMutableDictionary dictionary];
        NSMutableDictionary *stillDic4 = [NSMutableDictionary dictionary];
        
         stillDic1 = [stillArray objectAtIndex:0];
         stillDic2 = [stillArray objectAtIndex:1];
         stillDic3 = [stillArray objectAtIndex:2];
         stillDic4 = [stillArray objectAtIndex:3];
        
        NSString *stillStr1 = [stillDic1 objectForKey:@"image"];
        NSString *stillStr2 = [stillDic2 objectForKey:@"image"];
        NSString *stillStr3 = [stillDic3 objectForKey:@"image"];
        NSString *stillStr4 = [stillDic4 objectForKey:@"image"];
        
        NSURL *stillUrl1 = [NSURL URLWithString:stillStr1];
        NSURL *stillUrl2 = [NSURL URLWithString:stillStr2];
        NSURL *stillUrl3 = [NSURL URLWithString:stillStr3];
        NSURL *stillUrl4 = [NSURL URLWithString:stillStr4];
        
        [self.stillImage1 sd_setImageWithURL:stillUrl1 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        [self.stillImage2 sd_setImageWithURL:stillUrl2 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        [self.stillImage3 sd_setImageWithURL:stillUrl3 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        [self.stillImage4 sd_setImageWithURL:stillUrl4 placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"失败==== %@",error);
        
    }];
    
}

@end
